<ul class="nav navbar-nav">
   <% top_menus.each do |menus|
     menu = menus.keys[0] 
     sub_menus = menus.values[0]
     if sub_menus.is_a?(Array) %>
      <li class="dropdown">
        <a href="#" class="dropdown-toggle" data-toggle="dropdown"><%= t(menu) %><span class="caret"></span></a>
        <ul class="dropdown-menu" role="menu">
          <% sub_menus.each do |sm| %>
            <li><a href="/admin/<%= sm %>"><%= t(sm) %></a></li>
          <% end %>
        </ul>
      </li>
      <% else %>
        <% m = send("admin_#{menu}_path") rescue send("#{menu}_path")  %>
        <li <%= request.path == m ? "class=active" : "" %>>
          <%= link_to t(menu), m %>
        </li>
      <% end %>
    <% end %>
</ul>
<% if current_user %>
  <ul class="nav navbar-nav navbar-right">
    <li class="dropdown">
      <a href="#" class="dropdown-toggle" data-toggle="dropdown">我的账户<span class="caret"></span></a>
      <ul class="dropdown-menu" role="menu">
        <li><a href="<%= user_path(current_user) %>"><%= current_user.try(:email) %></a></li>
        <li><%= link_to t(:logout), logout_path %></li>
      </ul>
    </li>
  </ul>
<% end %>
